package co.com.ces4.client.baseView;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;

/**
 *
 * @author win
 */
public class CreateBase extends SectionStack {

    protected final SectionStackSection sectionContainer;
    protected final HLayout actionFormLayout;

    public CreateBase(String titleContainer, String width) {
        this(width);
        this.sectionContainer.setTitle(titleContainer);
        addSection(sectionContainer);
    }

    protected CreateBase(String width) {
        this.sectionContainer = new SectionStackSection();
        this.actionFormLayout = new HLayout();
        this.setWidth(width);
        this.setHeight100();
        this.setVisibilityMode(VisibilityMode.MULTIPLE);
        this.actionFormLayout.setAlign(Alignment.LEFT);
        this.setShowExpandControls(false);
        this.setAnimateSections(true);
        this.sectionContainer.setExpanded(true);
        this.sectionContainer.setCanCollapse(false);
        this.sectionContainer.setTitle("");
        this.actionFormLayout.setHeight(10);
        this.sectionContainer.setItems(this.actionFormLayout);
    }

    public void addSectionContainerItem(Canvas item) {
        this.sectionContainer.addItem(item);
    }

    public void setSectionContainerItems(Canvas... items) {
        this.actionFormLayout.setMembers(items);
    }

    public void hideActionBar() {
        this.sectionContainer.setHidden(true);
    }

    public void showActionBar() {
        this.sectionContainer.setHidden(false);
    }

    public void setActionBarAlignment(Alignment alignment) {
        this.actionFormLayout.setAlign(alignment);
    }
}
